package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	CheckTagEventNew           = "mes.CheckTagNew"
	CheckTagEventBeforeCreate  = "mes.CheckTagBeforeCreate"
	CheckTagEventBeforeUpdate  = "mes.CheckTagBeforeUpdate"
	CheckTagEventBeforeSave    = "mes.CheckTagBeforeCreate mes.CheckTagBeforeUpdate"
	CheckTagEventAfterCreate   = "mes.CheckTagAfterCreate"
	CheckTagEventAfterUpdate   = "mes.CheckTagAfterUpdate"
	CheckTagEventAfterSave     = "mes.CheckTagAfterCreate mes.CheckTagAfterUpdate"
	CheckTagEventDelete        = "mes.CheckTagDelete"
	CheckTagAccessControlEvent = "mes.CheckTagAccessControl"
)

func GetCheckTagConfig() *mgo.DocConfig {
	return CheckTag_Config
}

var CheckTag_Config *mgo.DocConfig

func init() {
	CheckTag_Config = NewCheckTagConfig()
}
func NewCheckTagConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "mes.CheckTag",
		Fields: []string{
			"name", "process", "code", "group",
		},
		RelationFields: []string{
			"process", "group",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"process": {
				Config:     GetCheckProcessConfig,
				DocName:    "CheckProcess",
				JoinType:   "O",
				KeyInside:  "processId",
				KeyOutSide: "id",
			},
			"group": {
				Config:     GetCheckResultGroupConfig,
				DocName:    "CheckResultGroup",
				JoinType:   "O",
				KeyInside:  "groupId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
